#include<stdio.h>

int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	int a[n+1];
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	while(m--)
	{
		int l = 0;
		int r = n + 1;
		int x,mid;
		scanf("%d",&x);
		while(l+1!=r)
		{
			mid = (l+r)/2;
			if(a[mid] < x)
			{
				l = mid;
			}
			if(a[mid] >= x)
			{
				r = mid;
			}
		}
		if(a[r] == x)
		{
			printf("%d ",r);
		}else{printf("-1 ");}
	}
	return 0;
}
